package hashtable;

public class Student {
    private int age;
    private String name;

    public Student(int age,String name){
        this.age = age;
        this.name = name;
    }
    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        int b = 31;
        int hash = 0;
        hash = hash * b + age;
        hash = hash * b + this.name.toLowerCase().hashCode();
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj ==this){
            return true;
        }
        if(obj == null){
            return false;
        }

        if(obj.getClass() != this.getClass()){
            return false;
        }

        Student another = (Student)obj;
        return this.age == another.getAge() && this.name.toLowerCase().equals(another.getName().toLowerCase());
    }
}
